﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Nascenture.Models;
//using System.Web.UI.WebControls;
namespace Nascenture.Controllers
{

    public class PortfolioController:Controller
    {
        private NascentureDBContext db = new NascentureDBContext();
        //public ActionResult Portfolio()
        //{
           

        //    return View(db.Portfolio.ToList());
        //    //RedirectToAction("Portfolio");
        //    //return View(db.Portfolio.OrderBy(model => model.Title));
        //}
        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
       [HttpGet]
        public ActionResult Portfolio(int? id)
        {
            var Return=View(db.Portfolio.ToList());
            if (id == 1)
            {
                //IEnumerable<Portfolio> query = db.Portfolio.OrderBy(model => model.Title);
                //return RedirectToAction("Portfolio", db.Portfolio.OrderBy(model => model.Title));
                Return= View(db.Portfolio.OrderBy(model => model.Title));
            }
            if (id == 2)
            {
                //IEnumerable<Portfolio> query = db.Portfolio.OrderBy(model => model.Title);
                //return RedirectToAction("Portfolio", db.Portfolio.OrderBy(model => model.Title));
                Return = View(db.Portfolio.OrderBy(model => model.Sort));
            }
            if (id == 3)
            {
                //IEnumerable<Portfolio> query = db.Portfolio.OrderBy(model => model.Title);
                //return RedirectToAction("Portfolio", db.Portfolio.OrderBy(model => model.Title));
                Return = View(db.Portfolio.OrderBy(model => model.Sort));
            }

            return Return;
        }

    }
}